﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace FlaresAtHand
{
    public partial class ActionForm : Form, IDisposable
    {
        public enum LogLevel {Info, Warning, Error, Success };
        private bool errorOccurred = false;

        public ActionForm()
        {
            InitializeComponent();
            this.Show();
        }

        public void Log(String message, LogLevel logLevel)
        {
            if (logLevel == LogLevel.Error)
                errorOccurred = true;
            //var lbl = new TextBox();
            //lbl.Multiline = true;
            //lbl.Enabled = false;
            //lbl.BackColor = Color.Green;
            //lbl.Text = message;
            listBoxLog.Items.Add(message);
            listBoxLog.Refresh();
        }
        
        public void Log(String message)
        {
            this.Log(message, LogLevel.Info);
        }

        #region IDisposable Members

        void IDisposable.Dispose()
        {
            Thread.Sleep(1000);
            this.Close();
            this.Dispose();
        }

        #endregion
    }
}